package main

import "fmt"

type Fruit interface {
	Eat()
}
type Orange struct {
	Name string
}

func (o *Orange) Eat() {
	fmt.Println("orange:", o.Name)
}
func NewOrange(name string) Fruit {
	return &Orange{Name: name}
}

type Cherry struct {
	Name string
}

func (c *Cherry) Eat() {
	fmt.Println("cherry name:", c.Name)
}

func NewCherry(name string) Fruit {
	return &Cherry{Name: name}
}

type FruitCreator func(name string) Fruit

type FruitCreateFactory struct {
	creates map[string]FruitCreator
}

func NewFruitCreateFactory() *FruitCreateFactory {
	return &FruitCreateFactory{
		creates: map[string]FruitCreator{
			"orange": NewOrange,
			"cherry": NewCherry,
		},
	}
}
func (f *FruitCreateFactory) CreateFruit(tp string) {

}
func main() {

}
